import React from "react";
import { BrowserRouter, Link, Route } from "../react-router-dom";
import Detail from "./Detail"


class Product extends React.Component {
  constructor(props) {
    super(props);
    this.state = { confirm: false };
  }
  render() {
    const { match } = this.props;
    console.log(this.props,123);
    const { url } = match ||{};
    const { id } = match?.params||{};

    return (
      <div>
        Product:{id}
        <Link to={url + "/detail"}>详情</Link>
        <Route path={url + "/detail"} component={Detail} />
        {/* <Prompt
          when={this.state.confirm}
          // message="Are you sure you want to leave?"
          message={location => {
            return "Are you sure you want to leave-fun";
          }}
        /> */}
      </div>
    );
  }
}

export default Product